package com.turing.post.datatranferpibs.util;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.IdClass;
import javax.persistence.Table;

@SuppressWarnings("serial")
@Entity
@Table(name = "CARDMANAGERDETAIL")
@IdClass(CardManagerDetail.class)
public class CardManagerDetail implements Serializable {

	private Integer CardId;// (PK,FK) 储值卡ID integer Not Null 参考CardManager
	private String CardNo;// (PK) 卡号 varchar(20) Not Null
	private Integer Amount;// 发生额(分) number(12) Not Null
	private Integer Balance;// 余额(分) number(12) Not Null

	public CardManagerDetail() {
		super();
	}

	@Id
	@Column(name = "CardId")
	public Integer getCardId() {
		return CardId;
	}

	public void setCardId(Integer cardId) {
		CardId = cardId;
	}

	@Id
	@Column(name = "CardNo")
	public String getCardNo() {
		return CardNo;
	}

	public void setCardNo(String cardNo) {
		CardNo = cardNo;
	}

	@Column(name = "Amount")
	public Integer getAmount() {
		return Amount;
	}

	public void setAmount(Integer amount) {
		Amount = amount;
	}

	@Column(name = "Balance")
	public Integer getBalance() {
		return Balance;
	}

	public void setBalance(Integer balance) {
		Balance = balance;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((getCardId() == null) ? 0 : getCardId().hashCode());
		result = prime * result
				+ ((getCardNo() == null) ? 0 : getCardNo().hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		final CardManagerDetail other = (CardManagerDetail) obj;
		if (getCardId() == null) {
			if (other.getCardId() != null)
				return false;
		} else if (!getCardId().equals(other.getCardId()))
			return false;
		if (getCardNo() == null) {
			if (other.getCardNo() != null)
				return false;
		} else if (!getCardNo().equals(other.getCardNo()))
			return false;
		return true;
	}

}
